1. Field of the Invention
The present invention relates to an image processing method for detecting an object from an input image using a template image, and relates to an image processing apparatus therefor.
2. Description of the Related Art
Conventionally, a technique is well known in which a template image is pre-registered, and the position in an input image of an image similar to the template image is detected by pattern matching between the input image and the template image. However, since distorted perceptions are liable to be shaped according to the manner in which the background of the image similar to the template image is formed, Japanese Published Unexamined Patent Application No. Hei-5-28273 discloses a technique that has been developed to solve this problem. In this publication, a similarity value between the template image and the image corresponding to the template image is defined by the mathematical Formula 1.
Formula 1
    Cv: Correlation coefficient (similarity value)    M: Number of pixels of template image in x direction    N: Number of pixels of template image in y direction    Sx: Derivative value of input image S in x direction    Sy: Derivative value of input image S in y direction    Tx: Derivative value of template image T in x direction    Ty: Derivative value of template image T in y direction
                              σ          S0                =                ⁢                                            1              MN                        ⁢                                          ∑                                  i                  =                  1                                M                            ⁢                                                          ⁢                                                ∑                                      j                    =                    1                                    N                                ⁢                                                                  ⁢                                  (                                                            Sx                      ij                      2                                        +                                          Sy                      ij                      2                                                        )                                                                                                      σ          T0                =                ⁢                                            1              MN                        ⁢                                          ∑                                  i                  =                  1                                M                            ⁢                                                          ⁢                                                ∑                                      j                    =                    1                                    N                                ⁢                                                                  ⁢                                  (                                                            Tx                      ij                      2                                        +                                          Ty                      ij                      2                                                        )                                                                                                      ρ          V0                =                ⁢                              1            MN                    ⁢                                    ∑                              i                =                1                            M                        ⁢                                                  ⁢                                          ∑                                  j                  =                  1                                N                            ⁢                                                          ⁢                              (                                                                            Tx                      ij                                        ⁢                                          Sx                      ij                                                        +                                                            Ty                      ij                                        ⁢                                          Sy                      ij                                                                      )                                                                            Cv        =                ⁢                              ρ            V0                                              σ              T0                        ⁢                          σ              S0                                          
In detail, an inner product (cos θ) of an angle θ between a normal direction vector of the edge of the template image and a normal direction vector of the edge of the input image is a component of the similarity value.
However, there exists a problem in that, as described later in detail, if the brightness of a background periphery of an image of an object is uneven, the positive and negative values of the inner product are reversed. This makes the similarity value unsuitable for the real image, and distorted perceptions are easily produced, thus making it difficult to obtain a desirable recognition result.
Additionally, the similarity value formula is nonlinear with respect to the normal direction vectors of the edges of the input and template images, and processing for the template image and processing for the input image must be performed simultaneously.
Further, the template image is scanned on the input image. A correlated calculation of the input image and the reference image must be performed for each scanning point. Therefore, in practicality, a resulting expansion of the amount of calculation makes real-time processing impossible.